package com.todo.partner.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/4/23 14:07
 * @description
 */
@Getter
@AllArgsConstructor
public enum PartnerRelationTypeEnum {

    SIGHT(0, "SIGHT", "景点"),
    STRATEGY(1, "STRATEGY", "攻略"),
    FOOD(2, "FOOD", "饭店美食"),
    POI(3, "POI", "POI"),
    ;

    private static Map<Integer, PartnerRelationTypeEnum> typeMap = Arrays
            .stream(PartnerRelationTypeEnum.values())
            .collect(Collectors.toMap(PartnerRelationTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static PartnerRelationTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
